﻿package collections4;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;

public class No1 {

	public static void main(String[] args) {
		File file = null;
		InputStream fis = null;
		try {
			file = new File("D:/1.txt");
			fis = new FileInputStream(file);
			int data;
			int line1 = 0;
			long s2 = System.nanoTime();
			while ((data = fis.read()) != -1) {
				if (data == 13)
					line1++;
			}
			long e2 = System.nanoTime();
			System.out.println(e2 - s2);
			System.out.println("该字符文件一共有" + line1 + "行");
		} catch (Exception e) {
			// TODO 自动生成的 catch 块
			e.printStackTrace();
		} finally {
			if (fis != null)
				try {
					fis.close();
				} catch (IOException e) {
					// TODO 自动生成的 catch 块
					e.printStackTrace();
				}
		}
	}
}
